//
//  IndexViewController.m
//  NiuNiuPacking
//
//  Created by shaoting on 14/10/19.
//  Copyright (c) 2014年 Reseek. All rights reserved.
//

#import "IndexViewController.h"
#import "Toast+UIView.h"

@interface IndexViewController ()

@end

@implementation IndexViewController
- (IBAction)showMenu:(id)sender {
    //全局变量
    //AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
    self.userBl = [[UserBl alloc] init];
    self.user = [self.userBl findById:1];

    
    if(self.user == nil) {
        UIStoryboard *mainStoryboard =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        UIViewController *regViewControllor=[mainStoryboard instantiateViewControllerWithIdentifier:@"loginController"];
        regViewControllor.modalPresentationStyle=UIModalPresentationFormSheet;
        regViewControllor.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
        [self presentViewController:regViewControllor animated:YES completion:^{NSLog(@"用户未登录过，跳转至登陆页面");
        }];
    } else {
        // 打开菜单
        [self.frostedViewController  presentMenuViewController];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
